import { ref } from "vue";

export const data = () => {
  const size = ref("");
  // 日期时间功能
  const value1 = ref("");
  const value2 = ref("");
  const shortcuts = [
    {
      text: "Today",
      value: new Date(),
    },
    {
      text: "Yesterday",
      value: () => {
        const date = new Date();
        date.setTime(date.getTime() - 3600 * 1000 * 24);
        return date;
      },
    },
    {
      text: "A week ago",
      value: () => {
        const date = new Date();
        date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
        return date;
      },
    },
  ];
  const disabledDate = (time) => {
    return time.getTime() > Date.now();
  };
  // 新增时间js
  const value3 = ref([
    new Date(2000, 10, 10, 10, 10),
    new Date(2000, 10, 11, 10, 10),
  ]);
  const shortcuts1 = [
    {
      text: "Last week",
      value: () => {
        const end = new Date();
        const start = new Date();
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
        return [start, end];
      },
    },
    {
      text: "Last month",
      value: () => {
        const end = new Date();
        const start = new Date();
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
        return [start, end];
      },
    },
    {
      text: "Last 3 months",
      value: () => {
        const end = new Date();
        const start = new Date();
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
        return [start, end];
      },
    },
  ];

  return [disabledDate, value1, value2, shortcuts, value3, shortcuts1, size];
};
